package network.rpc.protocol;

import java.io.Serializable;

/**
 * C/S之间服务交流的协议
 */
public class RpcRequest implements Serializable {
    private String serviceName; // 服务对象的名称
    private String methodName;  // 要使用服务对象的哪个方法
    private Class<?>[] paraTypes;   // 方法参数类型
    private Object[] params;    // 方法参数列表

    /**
     *
     * @param serviceName 服务提供者名称
     * @param methodName 要调用服务对象的什么方法
     * @param paraTypes 方法参数类型
     * @param params    方法具体参数参数
     */
    public RpcRequest(String serviceName, String methodName, Class<?>[] paraTypes, Object... params) {
        this.serviceName = serviceName;
        this.methodName = methodName;
        this.paraTypes = paraTypes;
        this.params = params;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public Class<?>[] getParaTypes() {
        return paraTypes;
    }

    public void setParaTypes(Class<?>[] paraTypes) {
        this.paraTypes = paraTypes;
    }

    public Object[] getParams() {
        return params;
    }

    public void setParams(Object[] params) {
        this.params = params;
    }
}
